/*
 * SOUNDBOX.H Version 1.01 (C)1995,1996 HUDSON SOFT
 * HuC6230(SOUNDBOX)関連 Ｃコンパイラ用ヘッダーファイル(SOUNDBOX.H)
 */
#ifndef _SOUNDBOX_H_
#define _SOUNDBOX_H_

#include	<system.h>

/* register set macros */

#define _put_sb_chsel(x) __OUTPORTB(IO_SB_CHSEL,x)
#define _put_sb_mvol(x) __OUTPORTB(IO_SB_MVOL,x)
#define _put_sb_frql(x) __OUTPORTB(IO_SB_FRQL,x)
#define _put_sb_frqh(x) __OUTPORTB(IO_SB_FRQH,x)
#define _put_sb_chvol(x) __OUTPORTB(IO_SB_CHVOL,x)
#define _put_sb_pan(x) __OUTPORTB(IO_SB_PAN,x)
#define _put_sb_wave(x) __OUTPORTB(IO_SB_WAVE,x)
#define _put_sb_noise(x) __OUTPORTB(IO_SB_NOISE,x)
#define _put_sb_lfpfrq(x) __OUTPORTB(IO_SB_LFOFRQ,x)
#define _put_sb_lfocr(x) __OUTPORTB(IO_SB_LFOCR,x)

#define _put_sb_adp_cr(x) __OUTPORTB(IO_SB_ADP_CR,x)
#define _put_sb_adp_voll0(x) __OUTPORTB(IO_SB_ADP_VOLL0,x)
#define _put_sb_adp_volr0(x) __OUTPORTB(IO_SB_ADP_VOLR0,x)
#define _put_sb_adp_voll1(x) __OUTPORTB(IO_SB_ADP_VOLL1,x)
#define _put_sb_adp_volr1(x) __OUTPORTB(IO_SB_ADP_VOLR1,x)
#define _put_sb_pcm_voll(x) __OUTPORTB(IO_SB_PCM_VOLL,x)
#define _put_sb_pcm_volr(x) __OUTPORTB(IO_SB_PCM_VOLR,x)

void init_soundbox(void);

extern zero u_char m_adp_cr;

void reset_adp(int reset);
#define ADP_RESET_0 0x10
#define ADP_RESET_1 0x20
#define ADP_RESET_ALL 0x30

void set_adp_liner(int ch, int sw);
#define ADP_LINER_OFF 0
#define ADP_LINER_ON 0x0c
#define SB_ADPCM_0 1
#define SB_ADPCM_1 2
#define SB_ADPCM_ALL 3

void set_adp_rate(int rate);
#define ADPCM_RATE32 0
#define ADPCM_RATE16 1
#define ADPCM_RATE8 2
#define ADPCM_RATE4 3

struct ADPVOL {u_char avoll0,avolr0,avoll1,avolr1;};
void set_adp_vol(struct ADPVOL *vols);

struct PCMVOL {u_char pvoll,pvolr;};
void set_pcm_vol(struct PCMVOL *vols);

#endif /* _SOUNDBOX_H_ */
